<template>
	<div class="register-phone">
		<step :step="1"></step>
		<table class="table_1_5">
			<tr class="tr2">
				<td>账户号码</td>
				<td>
					<input type="text" class="text" placeholder="请输入您的账户号码" v-model="code_phone.mobile" />
				</td>
			</tr>
			<tr class="tr2">
				<td>图片验证</td>
				<td>
					<ion-unlock ref="unlockref"></ion-unlock>
				</td>
			</tr>
			<tr style="text-align: center" class="tr2">
				<td></td>
				<td>
					<button v-on:click="next">下一步</button>
				</td>
			</tr>
		</table>
	</div>
</template>

<script>
	import step from './step'
	export default {
		components: {
			step,
		},
		data() {
			return {
				register_type: '',
				code_phone: {
					'mobile': '',
					'type': 'nreg',
				},
				code_tag: 60,
			};
		},
		methods: {
			next() {
				this.$router.push('/findpassword/verifyidentity_phone');
			},
			sendSMSCode() {
				if(this.code_tag < 60) {
					return;
				}
				var that = this;
				this.lh_http('post', "sendvcode", this.code_phone).done(function(res) {
					if(res.status) {

					} else {
						alert(res.data);
						that.runcode();
					}
				})

			},
			verificationCode(type) {
				UserService.verificationCode(this.code_phone);
			},
			runcode() {
				var that = this;
				var run = function() {
					that.code_tag--;
					if(that.code_tag <= 0) {
						clearInterval(timer)
						that.code_tag = 60;
					}
				}
				var timer = setInterval(run, 1000)
			}
		}
	};
</script>

<style lang="scss">
	.register-phone {}
	/* eslint-enable */
</style>